<template>
  <Kanban
    :colum="colum"
    :data="data"
    :maxRow="dictValue['车间工单看板展示最大条数']"
    type="workshopKanban"
  />
</template>
<script>
import { Kanban } from '@/components/index';
import { plantBoardPage } from '@/api/after-sale/workOrderManage/order';
import { getStoreId, getServerDict } from '@/utils';
import configData from '@/components/Kanban/settingConfig'
export default {
  components: {
    Kanban,
  },
  data () {
    return {
      colum: [{
        value: 'licensePlateNumber',
        name: '车牌'
      },
      {
        value: 'projectName',
        name: '作业项目'
      },
      {
        value: 'status',
        name: '状态',
        color: '#f40',
      },
      {
        value: 'userName',
        name: '作业人员'
      },
      {
        value: 'teamName',
        name: '班组'
      },
      {
        value: 'startDate',
        name: '作业开始时间'
      },
      {
        value: 'predictHours',
        name: '预计工时'
      },
      {
        value: 'predictDeliveryDate',
        name: '预计结束时间'
      },
      ],
      data: [],
      dictValue: {},
    }
  },
  methods: {
    async getDictValue () {
      configData.workshopKanban.dictKey.map(async (item) => {
        let data = await getServerDict(item);
        this.dictValue[item] = data[0].dictValue || ''
      })
    },
    getListData () {
      plantBoardPage({
        pageNo: 1, pageSize: 1000,
        teamId: this.dictValue['车间工单看板显示组'], yjsj: this.dictValue['车间工单看板超时预警'], storeId: getStoreId()
      }).then(res => {
        let { success, data } = res;
        if (success)
          this.data = data
      })
    }
  },
  created () {
    this.getDictValue();
    setTimeout(() => {
      this.getListData();
    }, 500)
  }
}
</script>